package com.zmj.sy.mom.srv.aps.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zmj.sy.mom.srv.aps.bean.entity.resource.DictData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DictDataMapper extends SyMapper<DictData> {

    @SuppressWarnings("all")
    @Select("select dd.*  " +
            "from tb_base_dict_data dd " +
            "left join tb_base_dict_type dt on dd.dict_type = dt.id " +
            "${ew.customSqlSegment} ")
    List<DictData> findByDictTypeCode(@Param(Constants.WRAPPER) QueryWrapper<DictData> qw);

    default List<DictData> findByDictTypeCode(String dictTypeCode){
        return findByDictTypeCode(Wrappers.<DictData>query().eq("dt.dict_code", dictTypeCode));
    }

    @SuppressWarnings("all")
    @Select("select dd.*  " +
            "from tb_base_dict_data dd " +
            "left join tb_base_dict_type dt on dd.dict_type = dt.id " +
            "where dt.dict_code = 'plateTextureU2d' " +
            "${ew.customSqlSegment} ")
    List<DictData> findTexture(@Param(Constants.WRAPPER) LambdaQueryWrapper<DictData> qw);

    @Select("select dd.*  " +
            "from tb_base_dict_data dd " +
            "left join tb_base_dict_type dt on dd.dict_type = dt.id " +
            "where dt.dict_code = 'plateTextureReplace' ")
    List<DictData> plateTextureReplace();

}
